<template>
  <div class="deleteContain">
    <el-dialog title="删除" :visible.sync="dialogVisible">
      <div class="dialog-body">
        <i class="el-icon-warning"></i>
        <span>确定删除此项隐患详情？</span>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button class="confirm" @click="confirm">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { deleteDangerContent } from '../../../api/danger'
export default {
  name: 'deleteDialog',
  data () {
    return {
      dialogVisible: false,
      safeId: ''
    }
  },
  methods: {
    openDialog (safeId) {
      this.dialogVisible = true
      this.safeId = safeId
    },
    closeDialog () {
      this.dialogVisible = false
    },
    confirm () {
      deleteDangerContent(this.safeId).then(res => {
        if (res.data.code === 200) {
          this.$message({
            type: 'success',
            message: res.data.message
          })
          this.$emit('reload')
          this.closeDialog()
        } else {
          this.$message({
            type: 'error',
            message: res.data.message
          })
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.deleteContain {
  .dialog-body {
    text-align: center;
    font-size: 18px;
    .el-icon-warning{
      color: #FFB415;
      margin-right: 8px;;
    }
  }
  .dialog-footer {
    button {
      font-size: 18px;
      width: 128px;
      height: 48px;
      border-radius: 28px;
      border: 2px solid rgba(72, 104, 255, 1);
    }
  }
}
</style>
<style lang="scss">
.deleteContain {
  .el-dialog {
    width: 560px;
    height: 360px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .el-dialog__header{
    font-weight: 500;
  }
  .el-dialog__footer {
    font-weight: 500;
    margin-bottom: 10px;
    text-align: center;
  }
  .dialog-footer button.cancel{
    width:128px;
    height:48px;
    background:rgba(72,104,255,1);
    border-radius:28px;
    font-size:18px;
    font-family:PingFangSC-Medium,PingFang SC;
    font-weight:500;
    color:rgba(255,255,255,1);
    line-height:48px;
  }
}
</style>
